package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import controller.viewController.trainingController;

public class trainingconfig {

	private JFrame frame;
	private JTextField textFieldCompanyName;
	private JTextField textFieldProduct;
	private JTextField textFieldStart;
	private JTextField textFieldDestination;
	private JTextField textFieldDays;
	private JTextField textFieldTrainer;
	private JTextField textFieldPlace;
	private JTextField textFieldBemerkungen;
	
	public trainingController tc;

	/**
	 * Launch the application.
	 */
//	public void init() {
//		EventQueue.invokeLater(new Runnable() {
//			@Override
//			public void run() {
//				try {
//					trainingconfig window = new trainingconfig();
//					window.frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	/**
	 * Create the application.
	 */
	public trainingconfig() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setResizable(false);
		frame.setBounds(100, 100, 730, 475);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JLabel lblProduct = new JLabel("Produkt:");
		lblProduct.setBounds(20, 42, 83, 14);
		frame.getContentPane().add(lblProduct);
		
		JLabel lblCompanyname = new JLabel("Firmenname:");
		lblCompanyname.setBounds(20, 11, 83, 14);
		frame.getContentPane().add(lblCompanyname);
		
		JLabel lblStart = new JLabel("Anfangsdatum:");
		lblStart.setBounds(20, 73, 83, 14);
		frame.getContentPane().add(lblStart);
		
		JLabel lblDestination = new JLabel("Enddatum:");
		lblDestination.setBounds(20, 104, 83, 14);
		frame.getContentPane().add(lblDestination);
		
		JLabel lblTrainer = new JLabel("Trainer:");
		lblTrainer.setBounds(20, 166, 83, 14);
		frame.getContentPane().add(lblTrainer);
		
		JLabel lblDays = new JLabel("Tage:");
		lblDays.setBounds(20, 135, 83, 14);
		frame.getContentPane().add(lblDays);
		
		JLabel lblPlace = new JLabel("Ort:");
		lblPlace.setBounds(20, 197, 83, 14);
		frame.getContentPane().add(lblPlace);
		
		JLabel lblBemerkungen = new JLabel("Bemerkungen:");
		lblBemerkungen.setBounds(20, 228, 83, 14);
		frame.getContentPane().add(lblBemerkungen);
		
		textFieldCompanyName = new JTextField();
		textFieldCompanyName.setBounds(117, 8, 280, 20);
		frame.getContentPane().add(textFieldCompanyName);
		textFieldCompanyName.setColumns(10);
		
		textFieldProduct = new JTextField();
		textFieldProduct.setBounds(117, 39, 280, 20);
		frame.getContentPane().add(textFieldProduct);
		textFieldProduct.setColumns(10);
		
		textFieldStart = new JTextField();
		textFieldStart.setBounds(117, 70, 86, 20);
		frame.getContentPane().add(textFieldStart);
		textFieldStart.setColumns(10);
		
		textFieldDestination = new JTextField();
		textFieldDestination.setBounds(117, 101, 86, 20);
		frame.getContentPane().add(textFieldDestination);
		textFieldDestination.setColumns(10);
		
		textFieldDays = new JTextField();
		textFieldDays.setBounds(117, 132, 44, 20);
		frame.getContentPane().add(textFieldDays);
		textFieldDays.setColumns(10);
		
		textFieldTrainer = new JTextField();
		textFieldTrainer.setBounds(117, 163, 240, 20);
		frame.getContentPane().add(textFieldTrainer);
		textFieldTrainer.setColumns(10);
		
		textFieldPlace = new JTextField();
		textFieldPlace.setBounds(117, 194, 240, 20);
		frame.getContentPane().add(textFieldPlace);
		textFieldPlace.setColumns(10);
		
		textFieldBemerkungen = new JTextField();
		textFieldBemerkungen.setBounds(117, 225, 240, 20);
		frame.getContentPane().add(textFieldBemerkungen);
		textFieldBemerkungen.setColumns(10);
		
		JButton btnCustomer = new JButton("Kunden verwalten");
		btnCustomer.setBounds(20, 341, 150, 23);
		frame.getContentPane().add(btnCustomer);
		btnCustomer.addActionListener(action_btnCustomer);
		
		JButton btnProduct = new JButton("Produkt hinzuf\u00FCgen");
		btnProduct.setBounds(180, 341, 150, 23);
		frame.getContentPane().add(btnProduct);
		btnProduct.addActionListener(action_btnProduct);
		
		JButton btnConfig = new JButton("Konfiguration speichern");
		btnConfig.setBounds(340, 341, 150, 23);
		frame.getContentPane().add(btnConfig);
		btnConfig.addActionListener(action_btnConfig);
		
		JButton btnBack = new JButton("Zur\u00FCck");
		btnBack.setBounds(500, 341, 150, 23);
		frame.getContentPane().add(btnBack);
		btnBack.addActionListener(action_btnBack);
		
		JLabel lblBotlane = new JLabel("PlEnTra /Training konfigurieren");
		lblBotlane.setBounds(10, 420, 694, 14);
		frame.getContentPane().add(lblBotlane);

		frame.setVisible(true);
	}
	
	public ActionListener action_btnCustomer = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			
			
		}
	};
	
	public ActionListener action_btnProduct = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			frame.setVisible(false);
			
			tc.goToAddProduct();
			
		}
	};
	
	public ActionListener action_btnConfig = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			
		}
	};
	
	public ActionListener action_btnBack = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			
		}
	};
}
